import mitt from "mitt";

export type MittType = "count" | "toy";

const emitter = mitt();

export function mittOn(type: MittType, handler: any) {
  emitter.on(type, handler);
}

export function mittEmit(type: MittType, v?: any) {
  emitter.emit(type, v);
}

export function mittOff(type: MittType) {
  emitter.off(type);
}
